package com.lzy.pattern.composite;

/**
 * @ClassName: MenuItem
 * @Description: 叶子节点（Leaf）：叶子节点对象，其下再无分支，是系统层次遍历的最小单位。
 * @Author: LiuZy
 * @Date: 2022/4/25 08:46
 * @Version: 1.0
 */
public class MenuItem extends MenuComponent{

    public MenuItem(String name, Integer level) {
        this.name = name;
        this.level = level;
    }

    @Override
    public void print() {
        for (Integer i = 1; i < this.level; i++) {
            System.out.print("--");
        }
        System.out.println(this.name);
    }
}